package com.examiner.dao;

import com.examiner.bean.Manager;
import com.examiner.bean.RoleMenu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface RoleMenuDao extends JpaRepository<RoleMenu,Integer>,
        JpaSpecificationExecutor<RoleMenu> {

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query( value = "select * from role_menu where role_name=:roleName",nativeQuery = true)
    List<RoleMenu> findAllByRoleName(@Param("roleName")String roleName);
}
